/**
 * 
 */
LoginPage = {
		'BindEvent': function(){
			$('#btn_submit').bind('click', function(){
				var cellphone = $('#txtCellphone').val();
				var pwd = $('#txtPwd').val();
				
				if(cellphone == '' || pwd == ''){
					alert('请输入用户名或密码');
					return false;
				}
				
				var result = AdminService.Login($('#txtCellphone').val(), $('#txtPwd').val());
				if(result.IsSuccess == 0){
					alert(result.ErrorMsg);
					return;
				}
				else{
					window.location.href = ServerConfig.UrlConfig.home_url;
					
				}
			});
			
			$('#btn_employee_submit').bind('click', function(){
				var cellphone		= $('#txt_cellphone').val();
				var employee_id		= $('#txt_employeeId').val();
				var employee_name	= $('#txt_employeeName').val();
				
				if(cellphone == '' || employee_id == '' || employee_name == ''){
					alert('请输入员工编号、姓名和手机号');
					return false;
				}
				
				var result = AdminService.EmployeeLogin(employee_id, employee_name, cellphone);
				if(result.IsSuccess == 0){
					alert(result.ErrorMsg);
					return;
				}
				else{
					window.location.href = ServerConfig.UrlConfig.home_url;
					
				}
			});
		},
};

$(document).ready(function(){
	LoginPage.BindEvent();
});


